package com.cxs.serviceabilitydemo;

import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.rpc.IRemoteObject;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;

public class LocalServiceAbility extends Ability {
    private static final HiLogLabel LABEL_LOG = new HiLogLabel(3, 0xD001100, "Demo");


    @Override
    public void onStart(Intent intent) {
        // 在创建Service的时候调用
        HiLog.error(LABEL_LOG, "LocalServiceAbility::onStart");
        super.onStart(intent);
        System.out.println("LocalServiceAbility::onStart");
    }



    @Override
    public void onStop() {
        // 在Service销毁时调用。
        super.onStop();
        HiLog.info(LABEL_LOG, "LocalServiceAbility::onStop");
        System.out.println("LocalServiceAbility::onStop");
    }

    @Override
    public void onCommand(Intent intent, boolean restart, int startId) {
        // 在Service创建完成之后调用。
        System.out.println("=============================================");
        System.out.println("restart: " + restart);
        System.out.println("startId: " + startId);
        System.out.println("=============================================");
    }

    @Override
    public IRemoteObject onConnect(Intent intent) {
        // 在Ability和Service连接时调用。
        return null;
    }

    @Override
    public void onDisconnect(Intent intent) {
        // 在Ability与绑定的Service断开连接时调用。
    }

    @Override
    public void onBackground() {
        super.onBackground();
        HiLog.info(LABEL_LOG, "LocalServiceAbility::onBackground");
    }
}